//
//  CaseManagerTypeController.m
//  QuickCure1
//
//  Created by zhouxuanhe on 16/11/1.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "CaseManagerTypeController.h"

@interface CaseManagerTypeController ()
//be used to saved the data
@property (nonatomic,strong) NSArray *arrayList;

@end
static NSString *cellType = @"cellType";
@implementation CaseManagerTypeController
#pragma mark -
#pragma mark - 加载视图
- (void)viewDidLoad {
    [super viewDidLoad];
    
    //调用方法
    [self setupUI];
}

#pragma mark -
#pragma mark - 初始化界面
-(void)setupUI
{
    _arrayList = @[@"肿瘤",@"血液病",@"心脑血管疾病",@"神经系统",@" 不孕不育"];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellType];
    
}

#pragma mark -
#pragma mark - 数据源
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return _arrayList.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellType forIndexPath:indexPath];
    cell.textLabel.text = _arrayList[indexPath.row];
    
    return cell;
}

#pragma mark -
#pragma mark - 点击cell的时候调用,用来返回这个cell上内容
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //**********************************
    //发送通知或block,将疾病类型发送过去
    NSString * cellTypeString = _arrayList[indexPath.row];
    [[NSNotificationCenter defaultCenter] postNotificationName:kIsUserTypeKey object:cellTypeString];
    if (_BlockCaseType) {
        _BlockCaseType(cellTypeString);
    }
    if (_BlockCaseTypeNum) {
        _BlockCaseTypeNum(@(indexPath.row + 1));
    }//将疾病类型以nsnumber的形式发送给上一级VC,再发送给细分疾病
    //然后pop到上一个VC
    [self.navigationController popViewControllerAnimated:YES];
}






@end
